#ifndef _OPTFLOW_HPP
#define	_OPTFLOW_HPP

#include <opencv/cv.h>
#include <opencv/highgui.h>

#include "cvutil.hpp"
#include "parameters.hpp"

#include <vector>
using std::vector;


class FrameSource {
public:
  FrameSource();

  bool setup(void);
  void update(void);

  cv::Mat get_frame(void) const;
  cv::Mat get_clean_frame(void) const;
  cv::Mat get_previous_clean_frame(void) const;

protected:
  cv::Mat frame;
  cv::Mat clean_frame;
  cv::Mat prev_clean_frame;

  cv::VideoCapture cam;
};


vector<cv::Point2f> find_hands_corners(cv::Mat& frame, cv::Point2f left_hint,
                                       cv::Point2f right_hint);


bool track_hands(cv::Mat& frame_a, cv::Mat& frame_b,
                 vector<cv::Point2f>& cur_points,
                 vector<cv::Point2f>& next_points);


#endif	/* _OPTFLOW_HPP */
